ifeq ($(BOARD_WLAN_DEVICE), $(filter $(BOARD_WLAN_DEVICE), sc2355 uwe5622))
ifeq ($(BOARD_SPRD_WCN_SOCKET), $(filter $(BOARD_SPRD_WCN_SOCKET),  sdio))
$(warning shell echo "$(BOARD_WLAN_DEVICE)")
$(warning shell echo "$(BOARD_SPRD_WCN_SOCKET)")

LOCAL_PATH:= $(call my-dir)

include $(CLEAR_VARS)
LOCAL_MODULE_TAGS := optional
LOCAL_MODULE := sprdwl_ng.ko
LOCAL_MODULE_CLASS := SHARED_LIBRARIES
LOCAL_MODULE_PATH := $(TARGET_OUT_VENDOR)/lib/modules
LOCAL_STRIP_MODULE := keep_symbols
LOCAL_SRC_FILES := $(LOCAL_MODULE)
include $(BUILD_PREBUILT)

ifeq ($(TARGET_BUILD_VARIANT),user)
DEBUGMODE := DEBUGMODE=n
else
DEBUGMODE := DEBUGMODE=y
endif

#convert to absolute directory
PRODUCT_OUT_ABSOLUTE:=$(shell cd $(PRODUCT_OUT); pwd)

$(LOCAL_PATH)/sprdwl_ng.ko: $(TARGET_PREBUILT_KERNEL)
	$(MAKE) -C $(shell dirname $@) ARCH=$(TARGET_KERNEL_ARCH) CROSS_COMPILE=$(KERNEL_CROSS_COMPILE) SPRDWL_PLATFORM=$(BOARD_WLAN_DEVICE) $(DEBUGMODE) KDIR=$(PRODUCT_OUT_ABSOLUTE)/obj/KERNEL clean
	$(MAKE) -C $(shell dirname $@) ARCH=$(TARGET_KERNEL_ARCH) CROSS_COMPILE=$(KERNEL_CROSS_COMPILE) SPRDWL_PLATFORM=$(BOARD_WLAN_DEVICE) MAKEFLAGS=$(DEBUGMODE) KDIR=$(PRODUCT_OUT_ABSOLUTE)/obj/KERNEL
	$(TARGET_STRIP) -d --strip-unneeded $@

endif
endif

